/* 
  用户好友集合
*/

import { SchemaFactory, Schema, Prop } from '@nestjs/mongoose'
import mongoose, { Document } from 'mongoose'

export type friendDocument = Friend & Document

@Schema({ timestamps: true })
class Friend {
  //自己的用户id
  @Prop({ required: true, ref: 'User' })
  myself: mongoose.Types.ObjectId
  //好友的用户id
  @Prop({ required: true, ref: 'User' })
  friend: mongoose.Types.ObjectId
}

const friendSchema = SchemaFactory.createForClass(Friend)

export { friendSchema, Friend }
